package com.xiaoshuidi.cloud.module.member.framework.config;

import com.xiaoshuidi.cloud.framework.datapermission.core.rule.dept.DeptDataPermissionRuleCustomizer;
import com.xiaoshuidi.cloud.module.member.pojo.feedback.MemberFeedback;
import com.xiaoshuidi.cloud.module.member.pojo.programarticle.MemberArticle;
import com.xiaoshuidi.cloud.module.member.pojo.programarticle.MemberProgramInfo;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration(proxyBeanMethods = false)
public class DataPermissionConfiguration {

    @Bean
    public DeptDataPermissionRuleCustomizer sysDeptDataPermissionRuleCustomizer() {
        return rule -> {
            // dept 基于部门的数据权限
            rule.addDeptColumn(MemberProgramInfo.class, "dept_id");
            rule.addDeptColumn(MemberArticle.class, "dept_id");
            rule.addDeptColumn(MemberFeedback.class, "dept_id");
        };
    }
}
